//
// Created by feng on 19-4-22.
//

#ifndef SOLARENERGY_CHIER_IMAGESMOOTHER_CUH
#define SOLARENERGY_CHIER_IMAGESMOOTHER_CUH

#include <driver_types.h>

namespace solar::cuda
{
    __device__ __host__ auto insert2(float* element_entry, int pos, float elem) -> bool;

    __global__ void trimmed_mean(float* d_output, cudaTextureObject_t texObj, int kernel_radius,
                                 float trimmed_ratio, int width, int height);

    __global__ void trimmed_gaussian(float* d_output, cudaTextureObject_t texObj, int kernel_radius,
                                     float trimmed_ratio, int width, int height, float sigma);

    class ImageSmoother
    {
        public:
            static void image_smooth(float* d_array, int kernel_radius, float trimmed_ratio,
                                     int width, int height);
            static void image_smooth(float* d_array, int kernel_radius, float trimmed_ratio,
                                     int width, int height, float sigma, cudaStream_t stream = nullptr);
            // input as well as output
    };
} // namespace solar::cuda

#endif // SOLARENERGY_CHIER_IMAGESMOOTHER_CUH
